// 开始
// window.addEventListener('DOMContentLoaded', () => {
//   const replaceText = (selector, text) => {
//     const element = document.getElementById(selector)
//     if (element) element.innerText = text
//   }

//   for(const dependency of ['chrome', 'node', 'electron']) {
//     replaceText(dependency + '-version', process.versions[dependency])
//   }
// })

// 预加载脚本
const { contextBridge, ipcRenderer } = require('electron')

// 通过contextBridge接口将特权接口暴露给渲染器
contextBridge.exposeInMainWorld('versions', {
  node: () => process.versions.node,
  chrome: () => process.versions.chrome,
  electron: () => process.versions.electron,
  ping: () => ipcRenderer.invoke('ping')
})
